<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>设备报修</title>
    <meta name="viewport" content="width=device-width"/>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css">
    <script src="js/ajax.js"></script>
</head>
<body>
<div id="app" >
    修理页面（显示故障）
    {{bxd}}

    <a href="javascript:;" onclick="jiedan(5)"
       style="width:90%;margin-top:20px;" class="weui-btn weui-btn_primary"
    >维修完成</a>

    <a href="javascript:;" onclick="jiedan(-1)"
       style="width:90%;margin-top:20px;" class="weui-btn weui-btn_primary"
    >维修失败</a>

</div>

<!-- body 最后 -->
<script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/jquery-weui.min.js"></script>

<!-- 如果使用了某些拓展插件还需要额外的JS -->
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/swiper.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/city-picker.min.js"></script>

<script>
    var v = new Vue({
        el: "#app",
        data: {
            bxd:null
        }
    });

    var url = document.URL;
    var index = url.indexOf("bxdid=")
    var  bxdid = url.substring(index+6);

    $.get("/find_bxd?id="+bxdid,null,function(data){
        v.bxd=data;
    })

    function jiedan(status){
        $.get("/jiedan?status="+status+"&bxdid="+v.bxd.id,null,function(data){
            if(data){
                $.toast("维修完成！辛苦！",function(){
                    location = 'repair_main.html';
                })
            }
        })

    }
</script>

</body>
</html>